package org.star.dolphin.factory;

import org.star.dolphin.constant.ResponseMessageConstant;
import org.star.dolphin.domain.ResponseMessage;

public class ResponseMessageFactory {

    private ResponseMessageFactory() {
    }

    public static <T> ResponseMessage<T> success() {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.F, ResponseMessageConstant.MSG.SUCCESS, null);
    }

    public static <T> ResponseMessage<T> success(T data) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.F, ResponseMessageConstant.MSG.SUCCESS, data);
    }

    public static <T> ResponseMessage<T> success(String msg, T data) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.F, msg, data);
    }

    public static <T> ResponseMessage<T> error() {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, "ERROR", null);
    }

    public static <T> ResponseMessage<T> error(Integer code) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, "ERROR", null, code);
    }

    public static <T> ResponseMessage<T> error(String msg, Integer code) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, msg, null, code);
    }

    public static <T> ResponseMessage<T> error(String msg) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, msg, null);
    }

    public static <T> ResponseMessage<T> error(String msg, T data) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, msg, data);
    }

    public static <T> ResponseMessage<T> error(String msg, T data, Integer code) {
        return new ResponseMessage<T>(ResponseMessageConstant.HAS_ERROR.T, msg, data, code);
    }

}
